<?php include("../../config/config.php"); 
if(!isset($_SESSION['csr_id'])){ header("location:index.php"); exit;}
$obj= new mycity();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>csr</title>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../../css/colorbox.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" charset="utf-8" src="../media/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="../media/js/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8" src="../media/js/TableTools.js"></script>
<script src="../../js/jquery.colorbox-min.js"></script>
<style type="text/css">
	@import "../media/css/demo_table_jui.css";
	@import "../media/themes/smoothness/jquery-ui-1.8.4.custom.css";
	@import "../media/css/demo_page.css";
	@import "../media/css/demo_table.css";
	@import "../media/css/TableTools.css";
</style>
<script type="text/javascript" charset="utf-8">
			$(document).ready( function () {
				$('#datatables').dataTable( {
					"sPaginationType":"full_numbers",
                    "aaSorting":[[2, "desc"]],
                    "bJQueryUI":true,
                    "bStateSave": true,
					"sDom": 'T<"clear">lfrtip',
					"oTableTools": {
						"aButtons": [
							"copy",
							"csv",
							"xls",
							{
								"sExtends": "pdf",
								"sPdfOrientation": "landscape",
								"sPdfMessage": ""
							},
							"print"
						]
					}
				} );
				
			$(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
			$(".ajax").colorbox();               
			} );
		</script>
 
</head>

<body>
<!--leftblock-->
<div class="leftblock" >
     <header>
       <h2>Welcome Admin</h2>
       <a href="logout.php">Logout</a><!--
       <span>400&nbsp;&nbsp;&nbsp;Pending Articals</span>-->
     </header>
        <ul> 
            <li><a href="#">Active Pages ( <?php echo $obj->count_rowall("SELECT * FROM `my_business_url` WHERE `status` = 1 "); ?> )</a></li> 
            <li><a href="inactive-pages.php">Inactive Pages ( <?php echo $obj->count_rowall("SELECT * FROM `my_business_url` WHERE `status` = 0 "); ?>  )</a></li>
            <li><a href="#">Total Registered User ( <?php echo $obj->count_rowall("SELECT * FROM `my_user` "); ?> )</a></li><br /><hr /><br />
            
            
            
         <?php /*?>   <li><a href="?type=image">Image Approval ( <?php echo $obj->count_rowall("SELECT * FROM `my_images` WHERE `status` = 0 "); ?> )</a></li>
            <li><a href="?type=article">Article Approval ( <?php echo $obj->count_rowall("SELECT * FROM `my_article` WHERE `status` = 0 "); ?> )</a></li>
            <li><a href="?type=url">Url Approval ( <?php echo $obj->count_rowall("SELECT * FROM `my_url` WHERE `status` = 0 "); ?> )</a></li>
            <li><a href="?type=pagedetails">Page Detail Approval ( <?php echo $obj->count_rowall("SELECT * FROM `my_page_details` WHERE `status` = 0 "); ?> )</a></li><?php */?>
            
        </ul>

     
</div>
 
 
 <!--leftblock end-->
 <div class="rightblock" style=" width:80%; float:left; min-height:400px;">
 <header>
 	<!--<div style="float:left;color: white;margin-top: 55px;">1 of 400</div>-->
     <div style="float: right;">
         <ul>   
          <!-- <li><input type="button" value="Approve"  /></li>
           <li><input type="button" value="Reject"  /></li>  
           <li><input type="button" value="Previous"  /></li>
           <li><input type="button" value="Next"  /></li> -->   
         </ul> 
     </div>
 </header>
<?php 
if(isset($_REQUEST['type'])&&($_REQUEST['type']=="image")){
	if(isset($_REQUEST['status'])&&($_REQUEST['status']!="")){
		$status=$obj->change_status('my_images',$_REQUEST['id'],$_REQUEST['status']);
		if($status==1){$_SESSION['msg']="Image Aproved Suscessfully!!";}else{$_SESSION['msg']="Image Rejected Suscessfully!!";}
	}
if(isset($_SESSION['msg'])){
?>
<div style="color:red; text-align:center; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
 <table  id="datatables" class="display">
    <thead>
      <tr>
        <th width="4%" scope="col">Sl.No</th>
        <th width="69%" scope="col">Images</th>
        <th width="5%" scope="col">Userid</th>
        <th width="22%" scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
    <?php $sl=1;
	$sql=mysql_query("SELECT * FROM `my_images` WHERE `status` = 0 ")or die(mysql_error());
	while($row=mysql_fetch_array($sql)){
	?>
      <tr>
        <td><?php echo $sl; ?></td>
        <td><a href="../../uploads/<?php echo $row['image']; ?>" class="group3"><?php echo $row['image']; ?></a></td>
        <td><?php echo $row['url_id']; ?></td>
        <td><div align="center"><input type="button" value="Approve" onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=1'"  />   <input type="button" value="Reject"  onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=2'"   /></div></td>
      </tr>
    <?php $sl++;}?>  
    </tbody>
    </table>
<?php }?>













<?php 
if(isset($_REQUEST['type'])&&($_REQUEST['type']=="article")){
	if(isset($_REQUEST['status'])&&($_REQUEST['status']!="")){
		$status=$obj->change_status('my_article',$_REQUEST['id'],$_REQUEST['status']);
		if($status==1){$_SESSION['msg']="Article Aproved Suscessfully!!";}else{$_SESSION['msg']="Article Rejected Suscessfully!!";}
	}
if(isset($_SESSION['msg'])){
?>
<div style="color:red; text-align:center; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
 <table  id="datatables" class="display">
    <thead>
      <tr>
        <th width="4%" scope="col">Sl.No</th>
        <th width="69%" scope="col">Images</th>
        <th width="5%" scope="col">Userid</th>
        <th width="22%" scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
    <?php $sl=1;
	$sql=mysql_query("SELECT * FROM `my_article` WHERE `status` = 0 ")or die(mysql_error());
	while($row=mysql_fetch_array($sql)){
	?>
      <tr>
        <td><?php echo $sl; ?></td>
        <td><a href="view_article.php?id=<?php echo $row['id']; ?>" class="ajax"><?php echo substr($row['article_title'],0,50); ?></a></td>
        <td><?php echo $row['url_id']; ?></td>
        <td><div align="center"><input type="button" value="Approve" onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=1'"  />   <input type="button" value="Reject"  onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=2'"   /></div></td>
      </tr>
    <?php $sl++;}?>  
    </tbody>
    </table>
<?php }?>









<?php 
if(isset($_REQUEST['type'])&&($_REQUEST['type']=="url")){
	if(isset($_REQUEST['status'])&&($_REQUEST['status']!="")){
		$status=$obj->change_status('my_url',$_REQUEST['id'],$_REQUEST['status']);
		if($status==1){$_SESSION['msg']="Url Aproved Suscessfully!!";}else{$_SESSION['msg']="Url Rejected Suscessfully!!";}
	}
if(isset($_SESSION['msg'])){
?>
<div style="color:red; text-align:center; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
 <table  id="datatables" class="display">
    <thead>
      <tr>
        <th width="4%" scope="col">Sl.No</th>
        <th width="69%" scope="col">Images</th>
        <th width="5%" scope="col">Userid</th>
        <th width="22%" scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
    <?php $sl=1;
	$sql=mysql_query("SELECT * FROM `my_url` WHERE `status` = 0 ")or die(mysql_error());
	while($row=mysql_fetch_array($sql)){
	?>
      <tr>
        <td><?php echo $sl; ?></td>
        <td><a href="../../uploads/<?php echo $row['image']; ?>" class="group3"><?php echo $row['image']; ?></a></td>
        <td><?php echo $row['userid']; ?></td>
        <td><div align="center"><input type="button" value="Approve" onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=1'"  />   <input type="button" value="Reject"  onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=2'"   /></div></td>
      </tr>
    <?php $sl++;}?>  
    </tbody>
    </table>
<?php }?>










<?php 
if(isset($_REQUEST['type'])&&($_REQUEST['type']=="pagedetails")){
	if(isset($_REQUEST['status'])&&($_REQUEST['status']!="")){
		$status=$obj->change_status('my_page_details',$_REQUEST['id'],$_REQUEST['status']);
		if($status==1){$_SESSION['msg']="Image Aproved Suscessfully!!";}else{$_SESSION['msg']="Image Rejected Suscessfully!!";}
	}
if(isset($_SESSION['msg'])){
?>
<div style="color:red; text-align:center; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
 <table  id="datatables" class="display">
    <thead>
      <tr>
        <th width="4%" scope="col">Sl.No</th>
        <th width="69%" scope="col">Images</th>
        <th width="5%" scope="col">Userid</th>
        <th width="22%" scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
    <?php $sl=1;
	$sql=mysql_query("SELECT * FROM `my_page_details` WHERE `status` = 0 ")or die(mysql_error());
	while($row=mysql_fetch_array($sql)){
	?>
      <tr>
        <td><?php echo $sl; ?></td>
        <td><a href="../../uploads/<?php echo $row['image']; ?>" class="group3"><?php echo $row['image']; ?></a></td>
        <td><?php echo $row['userid']; ?></td>
        <td><div align="center"><input type="button" value="Approve" onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=1'"  />   <input type="button" value="Reject"  onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=2'"   /></div></td>
      </tr>
    <?php $sl++;}?>  
    </tbody>
    </table>
<?php }?>















<?php 
if(isset($_REQUEST['type'])&&($_REQUEST['type']=="user")){
	if(isset($_REQUEST['status'])&&($_REQUEST['status']!="")){
		$status=$obj->change_status('my_user',$_REQUEST['id'],$_REQUEST['status']);
		if($status==1){$_SESSION['msg']="Image Aproved Suscessfully!!";}else{$_SESSION['msg']="Image Rejected Suscessfully!!";}
	}
if(isset($_SESSION['msg'])){
?>
<div style="color:red; text-align:center; font-size:16px;"><?php echo $_SESSION['msg']; unset($_SESSION['msg']); ?></div>
<?php }?>
 <table  id="datatables" class="display">
    <thead>
      <tr>
        <th width="4%" scope="col">Sl.No</th>
        <th width="69%" scope="col">Images</th>
        <th width="5%" scope="col">Userid</th>
        <th width="22%" scope="col">Action</th>
      </tr>
    </thead>
    <tbody>
    <?php $sl=1;
	$sql=mysql_query("SELECT * FROM `my_user` WHERE `status` = 0 ")or die(mysql_error());
	while($row=mysql_fetch_array($sql)){
	?>
      <tr>
        <td><?php echo $sl; ?></td>
        <td><a href="../../uploads/<?php echo $row['image']; ?>" class="group3"><?php echo $row['image']; ?></a></td>
        <td><?php echo $row['userid']; ?></td>
        <td><div align="center"><input type="button" value="Approve" onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=1'"  />   <input type="button" value="Reject"  onclick="location.href='?type=image&id=<?php echo $row['id']; ?>&status=2'"   /></div></td>
      </tr>
    <?php $sl++;}?>  
    </tbody>
    </table>
<?php }?>

 </div>

</body>
</html>
